package com.deer.wms.inventory.model.Inventory;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.deer.wms.project.root.annotaiton.MyAnnotation;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.boot.convert.DataSizeUnit;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import java.time.LocalDateTime;

/**
 * @Author: xu
 * @Date: 2022/10/11/9:58
 * @Description:
 */
@Data
public class InventoryExcel {
    private Integer itemTypeId;
    private String itemTypeName;
    private String cellUseType;
    private String spec;
    private String model;
    private String packCode;
    private String packName;
    private String supplierName;
    private String billNo;
    @MyAnnotation(columnIndex = 9,columnName = "仓库")
    private String areaName;
    @MyAnnotation(columnIndex = 4,columnName = "上架人")
    private String confirmUserName;
    @TableId(type = IdType.AUTO)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer inventoryId;

    private Integer wareId;

    /**
     * 仓库名称
     */
    @Column(name = "ware_name")
    private String wareName;

    /**
     * 货主ID
     */
    @Column(name = "organization_id")
    private Integer organizationId;

    /**
     * 货主名称
     */
    @Column(name = "organization_name")
    private String organizationName;

    /**
     * 物料编码
     */
    @Column(name = "item_code")
    @MyAnnotation(columnIndex = 1,columnName = "物料编码")
    private String itemCode;

    private String imgUrl;
    private Integer baoKuan;

    /**
     * 物料名称
     */
    @Column(name = "item_name")
    @MyAnnotation(columnIndex = 0,columnName = "物料名称")
    private String itemName;

    /**
     * 批次ID
     */
    @Column(name = "batch_id")
    private Integer batchId;

    /**
     * 批次名称
     */
    @Column(name = "batch_name")
    @MyAnnotation(columnIndex = 5,columnName = "批次")
    private String batchName;


    /**
     * 货位编码
     */
    @Column(name = "cell_code")
    @MyAnnotation(columnIndex = 2,columnName = "货位")
    private String cellCode;


    /**
     * 追踪号
     */
    @Column(name = "box_code")
    @MyAnnotation(columnIndex = 3,columnName = "容器")
    private String boxCode;

    /**
     * LPN号码
     */
    private String lpn;

    /**
     * 单位
     */
    @Column(name = "pack_detail_id")
    private Integer packDetailId;

    /**
     * 单位
     */
    @Column(name = "pack_describe")
    private String packDescribe;


    /**
     * 单位
     */
    @TableField(exist = false)
    private Double newReturnQty;


    @ApiModelProperty(value = "创建时间")
    @TableField(value = "modify_time", fill = FieldFill.INSERT)
    private LocalDateTime modifyTime;

    /**
     * 数量
     */

    @MyAnnotation(columnIndex = 6,columnName = "库存数量")
    private Double quantity;

    public Double getQuantity() {
        return ObjectUtil.isNotEmpty(quantity) ? quantity : 0;
    }

    public void setQuantity(Double quantity) {
        this.quantity = quantity;
    }

    /**
     * 分配数量
     */
    @Column(name = "allot_quantity")
    @MyAnnotation(columnIndex = 7,columnName = "分配数量")
    private Double allotQuantity;

    public Double getAllotQuantity() {
        return ObjectUtil.isNotEmpty(allotQuantity) ? allotQuantity : 0.00;
    }

    /**
     * 冻结数量
     */
    @Column(name = "freeze_quantity")
    @MyAnnotation(columnIndex = 8,columnName = "冻结数量")
    private Double freezeQuantity;

    private Integer state;
    /**
     * 状态描述，主要用于冻结状态的描述
     */
    private String stateDis;

    private Integer qcState;

    private Double transRatio;

    private Integer allotPackDetailId;
    private String allotPackDescribe;
    private Double allotTransRatio;
    private Integer freezePackDetailId;
    private String freezePackDescribe;
    private Double freezeTransRatio;
    private Integer erpAreaId;
    private Integer erpItemId;
    //入库仓库id
    private Integer asnStockId;
    //入库仓库名称
    private String asnStockName;

    @TableField(exist = false)
    private String beforeCode;


    @Column(name = "asn_detail_no")
    private String asnDetailNo;
    /**
     * 入库任务单号
     */
    private String asnBillNo;
    @MyAnnotation(columnIndex = 11,columnName = "履约号")
    private String agreementNo;
    private Integer isBatch;
    @MyAnnotation(columnIndex = 10,columnName = "MTo号")
    private String mtoNo;

    private Integer isComp;
    @TableField(exist = false)
    private String cellCodeAndItemCode;

    /**
     * 其他出库类型id
     */
    private Integer categoryId;
}
